import 'package:json_annotation/json_annotation.dart';
part 'chat.g.dart';

@JsonSerializable()
class ChatModel {
  /// 头像
  String header;

  /// 文本
  String msg;

  /// 类型 1= 文字, 2=语音
  int type;

  /// 是否自己
  bool oneself;

  ChatModel({required this.header, required this.msg, this.type = 1, this.oneself = false});

  factory ChatModel.fromJson(Map<String, dynamic> json) => _$ChatModelFromJson(json);

  Map<String, dynamic> toJson() => _$ChatModelToJson(this);

  @override
  String toString() {
    return toJson().toString();
  }
}
